package cn.doitedu.day05

import org.apache.spark.{SparkConf, SparkContext, TaskContext}

import java.net.InetAddress

object T10_TaskThreadSafeDemo1 {

  def main(args: Array[String]): Unit = {

    val conf = new SparkConf().setAppName(this.getClass.getSimpleName)
      .setMaster("local[4]")
    val sc = new SparkContext(conf)

    val lines = sc.textFile("data/date.txt")

    lines.mapPartitions(it => {
      val dateUtil = new DateUtilClass
      it.map(dt => {
        dateUtil.parse(dt)
      })
    }).foreach(println)

    sc.stop()
  }

}
